package cn.acac.yygh.mq;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class RabbitMqService {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    /**
     *  发送消息
     * @param exchange 交换机
     * @param routeKey 路由键
     * @param message 消息
     */
    public boolean sendMessage(String exchange,String routeKey,Object message){
        rabbitTemplate.convertAndSend(exchange,routeKey,message);
        return true;
    }
}
